When a package is executed (i.e. learner attempts it), each activity (page) of the package has
a data model as defined by SCORM 2004 and 1.2.
Microsoft Learning Components implements the data model in two ways. The two examples below
perform the same action—the first using client code executing in a browser, the second using
server code.
- MLC implements the SCORM RTE (JavaScript-based run-time environment) in the
Session Frameset. SCORM content can access the RTE using
JavaScript such as the following:
|
rteapi.SetValue("cmi.completion_status", "completed");
|
- Applications written in CLR-compatible languages such as C# and Visual Basic can access the
data model of an activity as follows:
|
learningSession.DataModel.CompletionStatus = CompletionStatus.Completed;
|
The first approach is documented in the SCORM Run-Time Environment documentation.
For the second approach, these are typical steps for accessing the data model of the current
activity of an attempt.
-
Acquire an instance of StoredLearningSession.
For example, call the
StoredLearningSession constructor or
StoredLearningSession.CreateAttempt. Note that the following steps assume that the learning
session has a current activity.
-
Retrieve the MLC object model corresponding to the current activity's SCORM data model
by reading the value of the
StoredLearningSession.CurrentActivityDataModel
property.
-
Use methods and properties of the returned
LearningDataModel
object to read and/or write the data model for the current activity.
-
If you wrote to the data model, call
StoredLearningSession.CommitChanges to write the changes back to the database.